



********************************************************************************
*  							REPLICATION DO FILE								   *
*																			   *
*		Does Economic Complexity Matter for the Mobilisation of Tax revenue	   *
*																			   *
********************************************************************************

/* 

	NB: Before runing this do file you need to install grstyle, ivreg2, xtabond2, 

	esttab and medsem command 
   
   
*/



/* 								Data Description							   */



/*  

	nrtax_inc_sc 				: non-resources tax including social contribution (% of GDP)
	direct_inc_sc_ex_rt			: non-resources direct tax including social contribution (% of GDP)
	nr_indirect					: non-resources indirect tax (% of GDP)
	tax_trade					: Trade tax (% of GDP)
	ECI 						: Economic complexity index
	eci_trade_similarity		: Economic complexity similarity
	lngdp_pc 					: GDP per capita in log
	inflation 					: Consumer price inflation
	Totalnaturalresourcesrents 	: Total natural resources rents (% of GDP)
	TradeofGDPNETRDGNFSZS 		: Trade openness (% of GDP)
	Agricultureforestryandfishi : Agriculture, forestry, and fishing, value added (% of GDP)
	v2x_corr 					: Political corruption index
	v2x_libdem 					: Liberal democracy index from
	left  						: Left wing government
	Urbanpopulationoftotalpop	: Urban population (% of total population)
	gini_disp					: Gini index
	hc							: Human capital index
	IDx							: dummy taking on for the country with the iso numerical code= Code and 0 otherwise
	
	
*/ 

asdoc sum nrtax_inc_sc direct_inc_sc_ex_rt nr_indirect tax_trade ECI, save(statglo.doc)
asdoc sum nrtax_inc_sc direct_inc_sc_ex_rt nr_indirect tax_trade ECI, by(developing) save(stat1.doc)


********************************************************************************
*								FIGURE 1
********************************************************************************

grstyle init

grstyle set plain

grstyle set color Accent: p#bar p#barline 

grstyle set inten 30: bar


xtile r_ECI=ECI, nq(2)
tab r_ECI
/*lab define r_ECIx 1"Low ECI" 2"High ECI" */
lab value r_ECI r_ECIx

graph bar (mean) nrtax_inc_sc, over( r_ECI) title("(A)", box bexpand size(medium)) saving(Fig1a, replace)


bysort code: egen mean_nrtax_inc_sc  = mean(nrtax_inc_sc)
bysort code: egen mean_ECI2  = mean(ECI)

twoway (scatter mean_nrtax_inc_sc mean_ECI2 , mlabel(Names) sort) (lfit mean_nrtax_inc_sc mean_ECI2), title("(B)", box bexpand size(medium)) saving(Fig1b, replace)

graph combine "Fig1a" "Fig1b", cols(2) saving(Fig1, replace)

graph export "Fig1.tif", replace /* we have excluded manually y axis lable */



********************************************************************************
*				TABLE 2. BASELINE RESULTS WITH FIXED-EFFETS
********************************************************************************

eststo eq1: qui xtreg nrtax_inc_sc ECI i.year,fe

eststo eq2: qui xtreg nrtax_inc_sc ECI lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi i.year, fe

eststo eq3: qui xtreg nrtax_inc_sc ECI v2x_corr v2x_libdem left i.year,fe

eststo eq4: qui xtreg nrtax_inc_sc ECI  Urbanpopulationoftotalpop i.year,fe

eststo eq5: qui xtreg nrtax_inc_sc ECI lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left  Urbanpopulationoftotalpop i.year,fe
 

esttab using Table2, se title(ECI and non-resources tax revenue, FE estimates) drop(*year) nonumbers sca(N r2_w N_g p) sfmt(0 3 3) label nodep nogaps compress star(* 0.10 ** 0.05 *** 0.01) b(%10.3f) nonotes addnotes("***, **, **, * indicate significance at the 1%, 5% and 10% levels of confidence. The numbers in parentheses represent standard errors. ") rtf replace 

eststo clear


********************************************************************************
* 		TABLE 3. SENSITIVITY TO OMITTED VARIABLES BIAS OSTER'S (2019) TEST
********************************************************************************

xtreg nrtax_inc_sc ECI lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop i.year,fe
psacalc delta ECI, rmax(0.7) beta(0)

/* to construct Table 3 we report in the table the estimated parameter of ECI in the regression and the standard error, then we also report the delta test result*/


********************************************************************************
* 					TABLE 4. BASELINE RESULTS WITH IV-2SLS
********************************************************************************

eststo eq1: ivreg2 nrtax_inc_sc ( ECI = eci_trade_similarity ), r endog( ECI ) first dkraay(2)
twostepweakiv 2sls nrtax_inc_sc ( ECI = eci_trade_similarity ),r

eststo eq2: ivreg2 nrtax_inc_sc ( ECI = eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi, r endog( ECI ) first dkraay(2)
twostepweakiv 2sls nrtax_inc_sc ( ECI = eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi,r

eststo eq3: ivreg2 nrtax_inc_sc ( ECI = eci_trade_similarity ) v2x_corr v2x_libdem left, r endog( ECI ) first dkraay(2)
twostepweakiv 2sls nrtax_inc_sc ( ECI = eci_trade_similarity ) v2x_corr v2x_libdem left,r

eststo eq4: ivreg2 nrtax_inc_sc ( ECI = eci_trade_similarity )  Urbanpopulationoftotalpop, r endog( ECI ) first dkraay(2)
twostepweakiv 2sls nrtax_inc_sc ( ECI = eci_trade_similarity )  Urbanpopulationoftotalpop,r

eststo eq5: ivreg2 nrtax_inc_sc ( ECI = eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop, r endog( ECI ) first dkraay(2)
twostepweakiv 2sls nrtax_inc_sc ( ECI = eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop,r

esttab using Table4, se title(ECI and non-resources tax revenue, results by type of taxes – IV-2SLS estimates) nonumbers r2 sca(N Fp idp estatp) sfmt(0 2 2) label nodep nogaps compress star(* 0.10 ** 0.05 *** 0.01) b(%10.3f) nonotes addnotes("***, **, **, * indicate significance at the 1%, 5% and 10% levels of confidence. The numbers in parentheses represent Driscroll-kray robust standard errors. ") rtf replace

eststo clear




********************************************************************************
*				TABLE 5. DEALING WITH TYPES OF TAX REVENUE
********************************************************************************

eststo eq1: ivreg2 direct_inc_sc_ex_rt ( ECI = eci_trade_similarity )  lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop, r endog(ECI) first dkraay(2)
twostepweakiv 2sls direct_inc_sc_ex_rt ( ECI = eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop,r


eststo eq2: ivreg2 nr_indirect ( ECI = eci_trade_similarity )  lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop, r endog(ECI) first dkraay(2)
twostepweakiv 2sls nr_indirect ( ECI = eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop,r


eststo eq3: ivreg2 tax_trade ( ECI = eci_trade_similarity )  lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop, r endog(ECI) first dkraay(2)
twostepweakiv 2sls tax_trade ( ECI = eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop,r


esttab using Table5, se title(Table 5. ECI and non-resources tax revenue, results by type of taxes – IV-2SLS estimates) nonumbers r2 sca(N Fp idp estatp) sfmt(0 3 3) label nodep nogaps compress star(* 0.10 ** 0.05 *** 0.01) b(%10.3f) nonotes addnotes("***, **, **, * indicate significance at the 1%, 5% and 10% levels of confidence. The numbers in parentheses represent Huber-White robust standard errors. ") rtf replace

eststo clear



********************************************************************************
*				TABLE 6. DEALING WITH THE LEVEL OF DEVELOPMENT
********************************************************************************

/* 								Developing countries			   			  */

eststo eq1: ivreg2 nrtax_inc_sc (c.ECI=c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==1, r endog(C.ECI) dkraay(2)
twostepweakiv 2sls nrtax_inc_sc ( ECI = eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==1,r

eststo eq2: ivreg2 direct_inc_sc_ex_rt (c.ECI =c.eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==1, r endog(C.ECI) dkraay(2)
twostepweakiv 2sls direct_inc_sc_ex_rt ( ECI = eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==1,r

eststo eq3: ivreg2 nr_indirect (c.ECI =c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==1, r endog(c.ECI) dkraay(2)
twostepweakiv 2sls nr_indirect (c.ECI =c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==1,r

eststo eq4: ivreg2 tax_trade (c.ECI =c.eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==1, r endog(c.ECI) dkraay(2)
twostepweakiv 2sls tax_trade (c.ECI =c.eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==1,r


/* 								Developed countries			   			  */

eststo eq5: ivreg2 nrtax_inc_sc (c.ECI=c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==0, r endog(C.ECI) dkraay(2)
twostepweakiv 2sls nrtax_inc_sc (c.ECI=c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==0,r

eststo eq6: ivreg2 direct_inc_sc_ex_rt (c.ECI =c.eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==0, r endog(C.ECI) dkraay(2)
twostepweakiv 2sls direct_inc_sc_ex_rt (c.ECI =c.eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==0,r

eststo eq7: ivreg2 nr_indirect (c.ECI =c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop  if developing==0, r endog(c.ECI) dkraay(2)
twostepweakiv 2sls nr_indirect (c.ECI =c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop  if developing==0,r

eststo eq8: ivreg2 tax_trade (c.ECI =c.eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==0, r endog(c.ECI) dkraay(2)
twostepweakiv 2sls tax_trade (c.ECI =c.eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop if developing==0,r

esttab using Table6, se title(Table 6. ECI and non-resources tax revenue, results by level of development – IV-2SLS estimates) nonumbers r2 sca(N Fp widstat idp estatp) sfmt(0 3 3) label nodep nogaps compress star(* 0.10 ** 0.05 *** 0.01) b(%10.3f) nonotes addnotes("***, **, **, * indicate significance at the 1%, 5% and 10% levels of confidence. The numbers in parentheses represent Huber-White robust standard errors. ") rtf replace
eststo clear


********************************************************************************
*				TABLE 7. DEALING WITH ALTERNATIVE MEASURE OF ECI
********************************************************************************
 
eststo eq1: ivreg2 nrtax_inc_sc (c.ECIplus = c.eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop, r endog(c.ECIplus) dkraay(2)
twostepweakiv 2sls nrtax_inc_sc (c.ECIplus = c.eci_trade_similarity ) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop,r

eststo eq2: ivreg2 direct_inc_sc_ex_rt (c.ECIplus =c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop, r endog(c.ECIplus) dkraay(2)
twostepweakiv 2sls direct_inc_sc_ex_rt (c.ECIplus =c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop,r

eststo eq3: ivreg2 nr_indirect (c.ECIplus = c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop, r endog(C.ECIplus) dkraay(2)
twostepweakiv 2sls nr_indirect (c.ECIplus = c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop,r

eststo eq4: ivreg2 tax_trade (c.ECIplus =c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop, r endog(c.ECIplus) dkraay(2)
twostepweakiv 2sls tax_trade (c.ECIplus =c.eci_trade_similarity) lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop,r



esttab using Table7, se title(Table 7. ECI and non-resources tax revenue, results using alternative ECI – IV-2SLS estimates ) nonumbers r2 sca(N Fp widstat idp estatp) sfmt(0 3 3) label nodep nogaps compress star(* 0.10 ** 0.05 *** 0.01) b(%10.3f) nonotes addnotes("***, **, **, * indicate significance at the 1%, 5% and 10% levels of confidence. The numbers in parentheses represent Huber-White robust standard errors. ") rtf replace
eststo clear


********************************************************************************
*		TABLE 8. DEALING WITH ENDOGENEITY 
********************************************************************************

eststo eq1: qui xtabond2 nrtax_inc_sc L.nrtax_inc_sc ECI lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop , gmm (nrtax_inc_sc , lag (2 2)collapse) gmm (ECI, lag (1 5) collapse) gmm (lngdp_pc, lag (2 1) collapse) gmm ( Urbanpopulationoftotalpop, lag (2 1)collapse) gmm (TradeofGDPNETRDGNFSZS, lag (1 4) collapse) gmm (Agricultureforestryandfishi ln_nat_res_abundance, lag (1 1) collapse) gmm ( v2x_corr , lag (1 3) collapse) gmm ( inflation , lag (1 2) collapse) gmm ( v2x_libdem , lag (1 3) collapse) iv(L.nrtax_inc_sc L(2/1).ECI L.lngdp_pc L4.inflation L4.ln_nat_res_abundance L4.TradeofGDPNETRDGNFSZS L4.Agricultureforestryandfishi L.v2x_corr L3.v2x_libdem L3.left L2.Urbanpopulationoftotalpop ID22 ID45 ID51 ID55 ID61 ID68 ID72 ID85) two

eststo eq2: qui xtabond2 direct_inc_sc_ex_rt L.direct_inc_sc_ex_rt ECI lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop , gmm ( direct_inc_sc_ex_rt , lag (2 2)collapse) gmm (ECI, lag (1 5) collapse) gmm (lngdp_pc, lag (1 1) collapse) gmm ( Urbanpopulationoftotalpop, lag (3 1)collapse) gmm (TradeofGDPNETRDGNFSZS, lag (1 5) collapse) gmm (Agricultureforestryandfishi ln_nat_res_abundance, lag (1 1) collapse) gmm ( v2x_corr , lag (1 3) collapse) gmm ( inflation , lag (1 2) collapse) gmm ( v2x_libdem , lag (1 3) collapse) iv(L.direct_inc_sc_ex_rt L(2/1).ECI L.lngdp_pc L4.inflation L4.ln_nat_res_abundance L4.TradeofGDPNETRDGNFSZS L4.Agricultureforestryandfishi L.v2x_corr L3.v2x_libdem L3.left L2.Urbanpopulationoftotalpop ID22 ID45 ID51 ID55 ID61 ID68 ID72 ID85) two

eststo eq3: qui xtabond2 nr_indirect L.nr_indirect ECI lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop , gmm ( nr_indirect , lag (2 2)collapse) gmm (ECI, lag (2 5) collapse) gmm (lngdp_pc, lag (2 1) collapse) gmm ( Urbanpopulationoftotalpop, lag (2 1)collapse) gmm (TradeofGDPNETRDGNFSZS, lag (1 4) collapse) gmm (Agricultureforestryandfishi ln_nat_res_abundance, lag (1 1) collapse) gmm ( v2x_corr , lag (1 1) collapse) gmm ( inflation , lag (1 2) collapse) gmm ( v2x_libdem , lag (1 2) collapse) iv(L3.nr_indirect L(2/1).ECI L.lngdp_pc L4.inflation L2.ln_nat_res_abundance L2.TradeofGDPNETRDGNFSZS L4.Agricultureforestryandfishi L.v2x_corr L3.v2x_libdem L.left L2.Urbanpopulationoftotalpop ID11 ID17 ID22 ID32 ID34 ID45 ID50 ID51 ID55 ID57 ID61 ID68 ID72 ID85 ID89) two


eststo eq4: qui xtabond2 tax_trade L.tax_trade ECI lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left Urbanpopulationoftotalpop , gmm ( tax_trade , lag (2 2)collapse) gmm (ECI, lag (1 5) collapse) gmm (lngdp_pc, lag (2 1) collapse) gmm ( Urbanpopulationoftotalpop, lag (2 1)collapse) gmm (TradeofGDPNETRDGNFSZS, lag (1 4) collapse) gmm (Agricultureforestryandfishi ln_nat_res_abundance, lag (1 1) collapse) gmm ( v2x_corr , lag (1 3) collapse) gmm ( inflation , lag (1 2) collapse) gmm ( v2x_libdem , lag (1 3) collapse) iv(L.tax_trade L(3/1).ECI L.lngdp_pc L4.inflation L4.ln_nat_res_abundance L4.TradeofGDPNETRDGNFSZS L4.Agricultureforestryandfishi L.v2x_corr L3.v2x_libdem L.left L2.Urbanpopulationoftotalpop ID22 ID45 ID51 ID55 ID61 ID68 ID72 ID85) two

esttab using Table8, se title(Table 8. ECI on non-resources tax revenue, GMM estimates) nonumbers r2 sca(N N_g j hansenp ar1p ar2p) sfmt(0 3 3) label nodep nogaps compress star(* 0.10 ** 0.05 *** 0.01) b(%10.3f) nonotes addnotes("***, **, **, * indicate significance at the 1%, 5% and 10% levels of confidence. The numbers in parentheses represent Huber-White robust standard errors. ") rtf replace

eststo clear




********************************************************************************
* transmission mechanisms
********************************************************************************

eststo eq1: qui sem(ECI -> lngdp_pc ) (ECI lngdp_pc ->nrtax_inc_sc), nocapslatent
medsem, indep(ECI) med(lngdp_pc) dep(nrtax_inc_sc) zlc rit rid
estat teffects

eststo eq2: qui sem(ECI -> lngdp_pc ) (ECI lngdp_pc ->direct_inc_sc_ex_rt), nocapslatent
medsem, indep(ECI) med(lngdp_pc) dep(direct_inc_sc_ex_rt) zlc rit rid
estat teffects

eststo eq3: qui sem(ECI -> lngdp_pc ) (ECI lngdp_pc ->nr_indirect), nocapslatent
medsem, indep(ECI) med(lngdp_pc) dep(nr_indirect) zlc rit rid
estat teffects

eststo eq4: qui sem(ECI -> lngdp_pc ) (ECI lngdp_pc ->tax_trade), nocapslatent
medsem, indep(ECI) med(lngdp_pc) dep(tax_trade) zlc rit rid
estat teffects



eststo eq5: qui sem(ECI -> hc ) (ECI hc ->nrtax_inc_sc), nocapslatent
medsem, indep(ECI) med(hc) dep(nrtax_inc_sc) zlc rit rid
estat teffects

eststo eq6: qui sem(ECI -> hc ) (ECI hc ->direct_inc_sc_ex_rt), nocapslatent
medsem, indep(ECI) med(hc) dep(direct_inc_sc_ex_rt) zlc rit rid
estat teffects

eststo eq7: qui sem(ECI -> hc ) (ECI hc ->nr_indirect), nocapslatent
medsem, indep(ECI) med(hc) dep(nr_indirect) zlc rit rid
estat teffects

eststo eq8: qui sem(ECI -> hc ) (ECI hc ->tax_trade), nocapslatent
medsem, indep(ECI) med(hc) dep(tax_trade) zlc rit rid
estat teffects



eststo eq9: qui sem(ECI -> gini_disp ) (ECI gini_disp ->nrtax_inc_sc), nocapslatent
medsem, indep(ECI) med(gini_disp) dep(nrtax_inc_sc) zlc rit rid
estat teffects

eststo eq10: qui sem(ECI -> gini_disp ) (ECI gini_disp ->direct_inc_sc_ex_rt), nocapslatent
medsem, indep(ECI) med(gini_disp) dep(direct_inc_sc_ex_rt) zlc rit rid
estat teffects

eststo eq11: qui sem(ECI -> gini_disp ) (ECI gini_disp ->nr_indirect), nocapslatent
medsem, indep(ECI) med(gini_disp) dep(nr_indirect) zlc rit rid
estat teffects

eststo eq12: qui sem(ECI -> gini_disp ) (ECI gini_disp ->tax_trade), nocapslatent
medsem, indep(ECI) med(gini_disp) dep(tax_trade) zlc rit rid
estat teffects


esttab using table9, se title(Table 9. SEM estimates) nonumbers sfmt(0 2 2) label nodep nogaps compress star(* 0.10 ** 0.05 *** 0.01) b(%10.3f) nonotes addnotes(" p < 0.10, ** p < 0.05, *** p < 0.01" "Huber-White robust standard errors in parentheses.") rtf replace


/*	to construct the table 10 we use the results of medsem estmation and results of teffects	*/

********************************************************************************
*
********************************************************************************


asdoc sum nrtax_inc_sc direct_inc_sc_ex_rt nr_indirect tax_trade ECI lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left  Urbanpopulationoftotalpop, save(stat.doc)

asdoc pwcorr nrtax_inc_sc direct_inc_sc_ex_rt nr_indirect tax_trade ECI lngdp_pc inflation ln_nat_res_abundance TradeofGDPNETRDGNFSZS Agricultureforestryandfishi v2x_corr v2x_libdem left  Urbanpopulationoftotalpop, save(correlation.doc)
